<?php require_once 'header.php';?>
        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <?php echo XXF_BACK?>
                            <?php echo xdb::getInstance()->getvar("select content from todoprivate where id=$tdid")?>
                            <textarea name="content" style="width:100%;height:200px;visibility:hidden;" id="todo"></textarea>
                            <input type="button" id="add" value="添加" onclick="add()"> 
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>内容</th>
                                        <th>图片附件</th>
                                        <th>添加时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	<?php
                                	$i=0;
                                	foreach ($result as $row){$i++;
                                	?>
                                    <tr class="gradeA" id='<?php echo $row['id'];?>'>
                                    	<td><?php echo $i;?></td>
                                        <td><?php echo html_entity_decode($row['content']);?></td>
                                        <td><a href='todoprivate/type/fujian/tdsid/<?php echo $row['id']?>/tdid/<?php echo $tdid?>'>[<?php echo xdb::getInstance()->getvar("select count(1) from todofujian where tdsid = ".$row['id'])?>]附件</a></td>
                                    	<td><?php echo $row['atime'];?></td>
                                        <td><a href='javascript:upd(<?php echo $row['id']?>)' style='color:red;'>改</a> <a href='javascript:del(<?php echo $row['id']?>)' style='color:red;'>删</a></td>
                                    </tr>
                                	<?php 
                                	}
                                	?>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
             </div>
        </div>
        <!-- DataTables JavaScript -->
<?php require_once 'bottom.php';?>
    <script charset="utf-8" src="kindeditor/kindeditor-all.js"></script>
    <script>
    var editor1;
	KindEditor.ready(function(K) {
		editor1 = K.create('textarea[name="content"]', {
			resizeType : 1,
			allowPreviewEmoticons : false,
			items : [
                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap'
            ]
		});
	});
	function add(){
		editor1.sync();
		$todo=$("#todo").val();
		if($todo.length>1){
			$.xconfirm("确定要添加？",function(tf){
				if(tf){
					$.xpost("todoprivate",{type:"addsub",content:$todo,tdid:'<?php echo $tdid?>'},function(data){
						if(data){
							window.location.reload();
						}
					});
				}
			});
		}
	}
	function del(id){
		$.xconfirm("删除后无法恢复，确定要删除此条记录么？",function(data){
 			if(data){
				$.xloading(1);
				$.xtodb("del","todosub",{},id,function(data){
					if(data==0){
						$.xloading(0);
						$.xalert("删除失败");
					}else{
						window.location.reload();
					}
				}); 
			} 
		});
	}
	function upd(id){
		location.href="todoprivate/type/todoupd/tdsid/"+id;
	}
    </script>